package file;

import java.io.File;


/**
 * @author Huangjin
 * @version 1.0
 * describe:文件过滤器lambda版本
 * @date 2023/3/6 17:21
 */
public class ListFileDemo3 {
    public static void main(String[] args) {
        File dir = new File(".");
        if (dir.isDirectory()){
            File[] subs = dir.listFiles( file->file.getName().endsWith(".txt"));
            for (File sub : subs){
                System.out.println(sub.getName());
            }
        }
    }
}
